<%@page import="java.sql.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<jsp:useBean id="databaseBean" scope="session" class="warehouse.DatabaseBean"/>  

    
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>添加供应记录</title>
	
	<link rel="stylesheet" href="layui/css/layui.css">
	<script src="layui/layui.js"></script>
	<script>
	var cargoNum = 0;
	layui.use('form', function(){
	  var form = layui.form;
	});
	layui.use('element', function(){
		  var element = layui.element;
		  
		  element.on('tabDelete(docDemoTabBrief)', function(data){
			  cargoNum--;
			});
		});
	
	</script>


</head>
<body>
	<h1 style="text-align:center">添加供应记录</h1>
	<form class="layui-form" action="add_supply.jsp" method="post">
		<!-- 供应商编号 -->
		
		<div class="layui-form-item">
		    <label class="layui-form-label">供应商编号</label>
		    <div class="layui-input-block">
		      <select name="supplierNo" lay-verify="required"> 
		        <option value="">请选择供应商编号</option>
		        <%
				String sql=String.format("SELECT supplierNo,name FROM supplier;");
				ResultSet rs=databaseBean.executeQuery(sql);
				while(rs.next()){
					%>
					<option value="<%=rs.getString("supplierNo")%>"><%=rs.getString("supplierNo")+" "+rs.getString("name")%></option>	
					<%
				}
				rs.close();
				%>
		        
		      </select>
		    </div> 
  		</div>
		<!--货物编号  -->
    	<div class="layui-form-item">
		    <label class="layui-form-label">货物编号</label>
		    <div class="layui-input-block">
		      <select name="cargoNo" lay-verify="required" class="my-cargoNo"> 
		        <option value="">请选择供应的货物的编号</option>
		        <%
				sql=String.format("SELECT cargoNo,name FROM cargo;");
				rs=databaseBean.executeQuery(sql);
				while(rs.next()){
					%>
					<option value="<%=rs.getString("cargoNo")%>"><%=rs.getString("cargoNo")+" "+rs.getString("name")%></option>	
					<%
				}
				rs.close();
				%>
		        
		      </select>
		    </div>
		</div>
		<!-- 供应量 -->
		<div class="layui-form-item">
		    <label class="layui-form-label">供应量</label>
		    <div class="layui-input-block">
		      <input name="supplyNum" type="text" lay-verify="required|number" placeholder="请输入供应量" class="layui-input my-purchaseNum">
		    </div>
		</div>

	    
	    <div class="layui-form-item" id="submitDiv">
	    <div class="layui-input-block">
	      	<button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
	      	<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	    </div>
  		</div>
	</form>


</body>
</html>